<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pay.sdk.service.channel4.*"%>
<%@ page import="com.alibaba.fastjson.*"%>
<%@ include file="/WEB-INF/commons/taglibs.jsp" %>
<%@ include file="/WEB-INF/commons/common-header.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="${ctx}/js/paymentjs.js"></script>
</head>
<body> 
<div style="display: none;">
	<%
	 String type = request.getParameter("redirect_type");
	 String  credential = "";
	 if("sd_prepay".equals(type)) { 		// 查询
		String out_trade_no = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"), "UTF-8");
		String order_time = new String(request.getParameter("order_time").getBytes("ISO-8859-1"), "UTF-8");	
		String total_fee = new String(request.getParameter("total_fee").getBytes("ISO-8859-1"), "UTF-8");
		String body = new String(request.getParameter("body").getBytes("ISO-8859-1"), "UTF-8");
		String client_ip = new String(request.getParameter("client_ip").getBytes("ISO-8859-1"), "UTF-8");
		String time_expire = new String(request.getParameter("time_expire").getBytes("ISO-8859-1"), "UTF-8");
		String notify_url = new String(request.getParameter("notify_url").getBytes("ISO-8859-1"), "UTF-8");
		String return_url = new String(request.getParameter("return_url").getBytes("ISO-8859-1"), "UTF-8");
		String device_info = new String(request.getParameter("device_info").getBytes("ISO-8859-1"), "UTF-8");
		String attach = new String(request.getParameter("attach").getBytes("ISO-8859-1"), "UTF-8");
		// 【重要】出于安全考虑，在调用函数前，需要对上面的参数进行防护过滤等操作
		String result = ChannelFourPay.quickPay(out_trade_no, order_time, total_fee, body, client_ip, notify_url, time_expire, return_url, device_info, attach);
		JSONObject jsonObj = JSONObject.parseObject(result);
		credential = jsonObj.getString("credential");
	}
	%> 
	 
</div>
</body>
</html>
